﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sustainalytics.PdfGeneration.Service;
using Sustainalytics.Synchronization.Interface;
using SimpleInjector;
using System.Web.Http.Dispatcher;
using System.Web.Http;
using Sustainalytics.Utils;

namespace Sustainalytics.ReportGenerator.BL.Tests
{
    [TestClass()]
    public class CRBulkGenerationTests
    {
        [TestMethod()]
        public void CRBulkGenerationTest()
        {
            
            var sc = new SyncContext()
            {                 
                GAConnectionStrings   = new Dictionary<string,string>(),
            };

            sc.GAConnectionStrings.Add("ClientDW", "mongodb://localhost/ClientDW_B");
            sc.GAConnectionStrings.Add("ClientPlatform", "mongodb://localhost/ClientPlatform");
            sc.GAConnectionStrings.Add("CompanyReportPDF", "mongodb://localhost/CompanyReportPDF_B");
            sc.GAConnectionStrings.Add("ControversyReportPDF", "mongodb://localhost/ControversyReportPDF_B");
            sc.GAConnectionStrings.Add("DWArchive", "mongodb://localhost/DWArchive_B");


            var step = new PdfReportGeneration(100, sc.GAConnectionStrings, sc.Token);
            sc.Token.ThrowIfCancellationRequested();

            var config = new HttpConfiguration();

            config.Filters.Add(new LogControllerFilter(true, true, false));

            var container = CompositionRoot.RegisterDependencies(config);

            config.Services.Replace(typeof(IHttpControllerActivator), new SimpleInjectorControllerActivator(container));

            step.Start(container);
        }
    }
}
